﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TinhNguyenVatLieuSanBay
{
    public partial class HeThong : Form
    {

        public string currentusername = null;
        private int childFormNumber = 0;

        public HeThong()
        {
            InitializeComponent();
        }

        public HeThong(string username)
        {
            InitializeComponent();
            currentusername = username;
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            Form childForm = new Form();
            childForm.MdiParent = this;
            childForm.Text = "Window " + childFormNumber++;
            childForm.Show();
        }

        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
            }
        }

        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = saveFileDialog.FileName;
            }
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CutToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void CopyToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void PasteToolStripMenuItem_Click(object sender, EventArgs e)
        {
        }

        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void HeThong_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void themdanhmucToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmDanhMuc.frmdanhmuc == null)
            {
                FrmDanhMuc view = new FrmDanhMuc();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmDanhMuc.frmdanhmuc.Activate();
            }
        }

        private void dungcuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmDungCu.frmdungcu == null)
            {
                FrmDungCu view = new FrmDungCu();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmDungCu.frmdungcu.Activate();
            }
        }

        private void thêmChuyênBayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmChuyenBay.frmchuyenbay == null)
            {
                FrmChuyenBay view = new FrmChuyenBay();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmChuyenBay.frmchuyenbay.Activate();
            }
        }

        private void phiêuDungCuChuyênBayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmPhieuDungCu.frmphieudungcu == null)
            {
                FrmPhieuDungCu view = new FrmPhieuDungCu();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmPhieuDungCu.frmphieudungcu.Activate();
            }
        }

        private void chiTiêtPhiêuDungCuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmDungCuPhucVuChuyenBay.frmdungcu == null)
            {
                FrmDungCuPhucVuChuyenBay view = new FrmDungCuPhucVuChuyenBay();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmDungCuPhucVuChuyenBay.frmdungcu.Activate();
            }
        }

        private void tinhNguyênVâtLiêuChuyênBayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmTinhNguyenVatLieuChuyenBay.frmtinhnguyenvatlieu == null)
            {
                FrmTinhNguyenVatLieuChuyenBay view = new FrmTinhNguyenVatLieuChuyenBay();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmTinhNguyenVatLieuChuyenBay.frmtinhnguyenvatlieu.Activate();
            }
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (FrmAbout.frmAbout == null)
            {
                FrmAbout view = new FrmAbout();
                view.MdiParent = this;
                view.Show();
            }
            else
            {
                FrmAbout.frmAbout.Activate();
            }
        }
    }
}
